<!DOCTYPE html>
<meta charset="UTF-8">
		      <table
			     class="easyui-datagrid"   
			     id="datagridd"  
		         url="${base}/user/getDynamicList?id=${id}"
		         pagination="true"
		         rownumbers="true"
		         toolbar="#toolbard"
		         data-options="pageSize:20,pageList:[2,10,20,30]" 
		         >  
		    <thead>  
		        <tr> 
		        	<th field="id" width="5%" checkbox="true"></th>
		        	<th data-options="field:'extraInfo',align:'center'" formatter="formatCategory" width="8%">用户名</th>
		            <th data-options="field:'type',align:'center'" formatter="typeName" width="8%">类型</th>
		            <th data-options="field:'createTime',align:'center'" width="14%">创建时间</th>
		            <th data-options="field:'title',align:'center'" width="64%">标题</th>
		            
		        </tr>
		    </thead>
		</table>    
<div id="toolbard">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:deleteDynamic();">删除</a>
</div> 

<script>
function deleteDynamic(){
	var rows = $('#datagridd').datagrid('getSelections');
   if (rows.length>0){
   	var ids = [];
   	for(var i=0; i<rows.length; i++){
   		ids.push(rows[i].id);
   	}
   	url = $("#base").val()+"/user/deleteDynamic?ids="+ids.join(",");
       $.messager.confirm('删除','确定要删除吗?',function(r){
           if (r){
               $.post(url,function(result){
               	var result = eval('('+result+')');
               	if (result.errorMsg){
                	   $.messager.alert('错误',"删除信息失败,请稍后再试",'error');
                	   $('#datagridd').datagrid('reload');   
                   } else if(result.infoMsg){
                	   $.messager.alert('提示',"删除信息成功",'info');
                	   $('#datagridd').datagrid('reload');   
                   }else{
                      $('#datagridd').datagrid('reload');   
                   }
               });
           }
       });
   }else{
   	 $.messager.alert('提示','请选择一条信息进行操作','info');
   }

}
    function formatCategory(value){
        return value.realname;
    }
    
    
    function typeName(value){
			if( value == 101){
				return "精选项目";		
	    	}
			if( value == 102){
				return "精选资金";
			}
			if( value == 201){
				return "发布项目意向";
			}
			if( value == 202){
				return "发布资金意向";
			}
    }
    
</script>


